#include <iostream>

int get_size(const int& i)
{
    return i;
}

/* const refere */
void const_func()
{
    const int bufSize = 512;
    const int i = get_size(bufSize);
    const int j = 43;
    const int cj = j;
    const int &r1 = cj;
    int r2 = 23;
    int &r3 = r2;
    const int &r4 = r3;
    std::cout << r3 << " " << r2 << " " << r4 << std::endl;
}

/* pointer to const */
void pconst_func()
{
    const double pi = 3.14;
    const double *cptr = &pi;
    std::cout << *cptr << " " << pi << std::endl;
    double dval = 2.333;
    cptr = &dval;
    std::cout << *cptr << " " << dval << std::endl;
}

int main()
{
    const_func();
    pconst_func();
    return 0;
}